//
//  ContactListViewController.h
//  Gildata
//
//  Created by 陆惠国 on 11-8-2.
//  Copyright 2011年 恒生聚源. All rights reserved.
//
#import <CoreData/CoreData.h>
#import "SectionHeaderView.h"

@class RosterTitleView;

@interface RosterViewController : UIViewController <UITableViewDelegate, UITableViewDataSource, UISearchDisplayDelegate, UISearchBarDelegate,NSFetchedResultsControllerDelegate, SectionHeaderViewDelegate, UIAlertViewDelegate>
{
    NSFetchedResultsController* _fetchedResultsController;
    NSMutableArray* _sections;  
    RosterTitleView* _rosterTitleView;
    UISearchBar* _searchBar;
    UISearchDisplayController* _searchDisplay;
    UITableView *_tableView;
    UIToolbar *_toolbar;
    NSString *_savedSearchTerm;
    BOOL _searchWasActive;
    BOOL _active;
}

@property (nonatomic, retain) UITableView* tableView;
@property (nonatomic, retain) UIToolbar* toolbar;

@property (nonatomic, retain) UISearchBar* searchBar;

@property (nonatomic, retain) UISearchDisplayController* searchDisplay;

@property (nonatomic, copy) NSString *savedSearchTerm;
@property (nonatomic, assign) BOOL searchWasActive;
@property (nonatomic, assign) BOOL active;
@property (nonatomic, retain) NSMutableArray* sections;
@property (nonatomic, readonly) NSFetchedResultsController* fetchedResultsController;

@property (nonatomic, readonly) RosterTitleView* rosterTitleView;

- (XMPPUserCoreDataStorageObject*)userForRowAtIndexPath:(NSIndexPath*)indexPath;
- (void)configureCell:(UITableViewCell *)cell forIndexPath:(NSIndexPath *)indexPath;

- (void)fetchRosters;
- (void)loadRosters;
- (void)reloadAvatar;
- (void)reloadData;

- (UIButton *) makeDetailDisclosureButton; 
- (void) accessoryButtonTapped: (UIControl *) button withEvent: (UIEvent *) event;
- (void) avatarTapped:(UITapGestureRecognizer *) recognizer;
-(void) handleSwipeFrom:(UISwipeGestureRecognizer *)recognizer;
- (void)handleSettingsChanged:(NSNotification *)notification;
@end
